<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加营业员</title>
    <link rel="stylesheet" href="__PEAR__/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                
				  <div class="layui-form-item">
				    <label class="layui-form-label">营业员编号</label>
				    <div class="layui-input-inline">
				      <input type="text" name="oper_id" id="oper_id" value="{$one['oper_id']}" {if condition="$one['oper_id'] neq ''"}readonly="readonly"{/if} placeholder="" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				     <label class="layui-form-label">所属门店</label>
				    <div class="layui-input-inline">
				      <select name="branch_no" lay-filter="branch_select" lay-search>
				        <option value="ALL">ALL</option>
				        {volist name="branchs" id="vo"}
				        <option value="{$vo['branch_no']}" {if condition="$one['branch_no'] eq $vo['branch_no']"}selected="selected"{/if}>{$vo['branch_name']}</option>
				        {/volist}
				      </select>
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">营业员名称</label>
				    <div class="layui-input-inline">
				      <input type="text" name="oper_name" value="{$one['oper_name']}" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">登录密码</label>
				    <div class="layui-input-inline">
				      <input type="password" name="oper_pw" value="" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  {present name="isadd"}
        			<input name="act" type="hidden" value="add"/>
        			{else/}
       				<input name="act" type="hidden" value="edit"/>
        		{/present}
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="oper-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="__STATIC__/lib/layui/layui.js"></script>
<script src="__PEAR__/component/pear/pear.js"></script>
<script>
layui.use(['form','jquery'],function(){
    let form = layui.form;
    let $ = layui.jquery;
    var path="{:U('pos/operator','','')}";
	
	var _url="/save";	
	
    form.on('submit(oper-save)', function(data){
        $.ajax({
            url:path+_url,
            data:JSON.stringify(data.field),
            dataType:'json',
            contentType:'application/json',
            type:'post',
            success:function(result){
                if(result.code){
                    layer.msg(result.msg,{icon:1,time:1000},function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("oper-table");
                    });
                }else{
                    layer.msg(result.msg,{icon:2,time:1000});
                }
            }
        })
        return false;
    });
})
</script>
<script>
</script>
</body>
</html>